package com.gome.axwl.aoc.common.enumCode;


import java.util.HashMap;

/**
 * @Author John LI
 */
public class DatabaseUpdateReturnCode {

    public static final int UPDATE_OK = 1;

    public static final int UPDATE_FAIL = 0;

    private int code;

    private String name;

    private String description;

    public DatabaseUpdateReturnCode(int code, String name, String description) {
        this.code = code;
        this.name = name;
        this.description = description;
    }

    public String getName() {
        return name;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }


    private static HashMap<Integer, DatabaseUpdateReturnCode> databaseReturnCodeList = new HashMap<Integer, DatabaseUpdateReturnCode>() {

        private static final long serialVersionUID = 1L;

        {
            // 自定义错误类型
            put(UPDATE_OK, new DatabaseUpdateReturnCode(UPDATE_OK, "更新返回字段", "更新成功"));
            put(UPDATE_FAIL, new DatabaseUpdateReturnCode(UPDATE_FAIL, "更新返回字段", "更新失败"));
        }
    };

    public static DatabaseUpdateReturnCode getDatabaseReturnCode(int code) {
        return databaseReturnCodeList.get(code);
    }
}